package exp3;

public class Color {
    private short red;
    private short green;
    private short blue;

    public Color() {
    }

    public Color(int red, int green, int blue) {
        if (red >= 0 && red <= 255) {
            this.red = (short) red;
        }
        if (green >= 0 && green <= 255) {
            this.green = (short) green;
        }
        if (blue >= 0 && blue <= 255) {
            this.blue = (short) blue;
        }
    }

    public short getRed() {
        return red;
    }

    public void setRed(int red) {
        if (red >= 0 && red <= 255) {
            this.red = (short) red;
        }
    }

    public short getGreen() {
        return green;
    }

    public void setGreen(int green) {
        if (green >= 0 && green <= 255) {
            this.green = (short) green;
        }
    }

    public short getBlue() {
        return blue;
    }

    public void setBlue(int blue) {
        if (blue >= 0 && blue <= 255) {
            this.blue = (short) blue;
        }
    }

    public void print() {
        System.out.println("RGB(" + this.red + "," + this.green + "," + this.green + ")");
    }
}
